<template>
	<div style="margin-bottom: 20px;">
		<el-table
			border
			size="mini"
			:data="tableData"
			style="width: 100%"
			:header-cell-style="getRowClass"
		>
			<el-table-column
				align="center"
				:label="`${$t('report.project')}`"
				min-width="80px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{ scope.row.venueName || '-' }}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="$t('funds.fund_audit.person_return_water')"
				min-width="150px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					{{
						handleNumber(scope.row.currency, scope.row.rebateAmount)
					}}
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="`${rebateRateTitle}`"
				min-width="150px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					<p>
						{{ handlePercentage(scope.row.rebateRate) }}
					</p>
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				:label="`${validBetAmountTitle}`"
				min-width="150px"
				show-overflow-tooltip
			>
				<template slot-scope="scope">
					<div
						v-if="isTexas"
						class="blueColor decoration"
						style="cursor: pointer;"
						@click="showDetails"
					>
						{{
							handleNumber(
								scope.row.currency,
								scope.row.serviceAmountContribution
							)
						}}
					</div>
					<template v-else>
						{{
							handleNumber(
								scope.row.currency,
								scope.row.validBetAmount
							)
						}}
					</template>
				</template>
			</el-table-column>
		</el-table>
		<ServiceChargeDetail
			from="member"
			module="funds"
			:dialog="dialog"
			kind=""
			:tableData="tableData"
			:handleClose="handleClose"
		/>
	</div>
</template>

<script>
import list from '@/mixins/list'
import ServiceChargeDetail from '@/components/Dialog/ServiceChargeDetail'
export default {
	mixins: [list],
	components: {
		ServiceChargeDetail
	},
	props: {
		isPlatform: {
			type: Boolean,
			default: false
		},
		isTexas: {
			type: Boolean,
			default: false
		},
		tableData: {
			type: Array,
			default: () => {}
		}
	},
	data() {
		return {
			dialog: false
		}
	},
	computed: {
		rebateRateTitle() {
			if (this.isPlatform) {
				return '平台发放返水比例'
			} else {
				return '代理发放返水比例'
			}
		},
		validBetAmountTitle() {
			if (this.isTexas) {
				return this.$t('common.service_charge')
			} else {
				return '有效投注'
			}
		}
	},
	methods: {
		showDetails() {
			this.dialog = true
		},
		handleClose() {
			this.dialog = false
		}
	}
}
</script>
